package com.hlz.aisearch

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.hlz.comment.base.BaseFragment
import com.hlz.lib_x5.BaseWebView
import org.jetbrains.anko.support.v4.find

class WebFragment : BaseFragment() {


    var url = ""

    companion object {

        @JvmStatic
        fun instance(): WebFragment {
            val bundle = Bundle()
            val fragment = WebFragment()
            fragment.arguments = bundle
            return fragment
        }

        @JvmStatic
        fun instance(bundle: Bundle): WebFragment {
            val fragment = WebFragment()
            fragment.arguments = bundle
            return fragment
        }
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        return inflater.inflate(R.layout.fragment_web, container, false)
    }


    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        arguments?.let {
            url = it.getString("url","https://www.baidu.com")
        }
        val webView = find<BaseWebView>(R.id.mWebView)
        webView.loadUrl("https://www.baidu.com")


    }
}